home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / kh_table.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  2KB  |  61 lines

  1. #ifndef _TAB_VIEW_H_
  2. #define _TAB_VIEW_H_
  3.  
  4. #include "simple.h"
  5. #include "geom.h"
  6. #include <alloc.h>
  7. /* This class incapsulates scroll view functions for viewing the table.
  8.     We suppose that width of columns is not constant, but height
  9.     of raw is fixed. "chars" is the size of default font.
  10.     Class is window-independent.
  11. */
  12.  
  13. class KH_TableView
  14.     {
  15.     protected:
  16.     ulong yStart;       // From beginning to page top, lines
  17.     int  xStart;        // From beginning column to page left, "chars"
  18.     int  yPos;          // From page top to y cursor position, lines
  19.     int  xPos;          // From page left to x cursor position, "chars"
  20.     int  xCurs;         // Current column number
  21.     ulong yCurs;        // Current raw number
  22.  
  23.     int xScreen;        // Screen viewport width, "chars"
  24.     int yScreen;        // Screen viewport height, "chars"
  25.  
  26.     int nColumns;       // Total columns number, -1 for detect
  27.     int* iColWidth;     // Array of widths of col.
  28.     int* colNumbers;    // Change order of col. to show
  29.  
  30.     public:
  31.     KH_TableView(int w, int h, int col = -1,
  32.           int* wid = NULL, int* colNum = NULL);
  33.  
  34.     ~KH_TableView()    {}
  35.  
  36.     void setWidth(int w) { xScreen = w; }
  37.     void setHeight(int h) { yScreen = h; }
  38.     int Left();
  39.     int Right();
  40.     int Up();
  41.     int Down();
  42.     void Home();
  43.     void End();
  44.     void PgUp();
  45.     void PgDown();
  46.     void CtrlPgUp();
  47.     void CtrlPgDown();
  48.     void PgLeft();
  49.     void PgRight();
  50.     void Rotate();
  51.     virtual void insRecord() {}
  52.     virtual void delRecord() {}
  53.     void SetScreen(int x, int y)   { xScreen = x; yScreen = y; }
  54.     void moveToCell(loc ms);
  55. // Return value: number of records in table or -1 if table have not
  56. // the fixed number of records.
  57.     virtual long RecordNumber()    { return 1L; }
  58.     virtual int getColumnNumber()  { return 1; }
  59.     };
  60.  
  61. #endif _TAB_VIEW_H_